package com.pan.common.interview.thread;

public class DieLock {
    public static Object o1 = new Object();
    public static Object o2 = new Object();
    public static void main(String[] args) {
        s1();
        s2();
    }

    public static void s1(){
        new Thread(()->{
            synchronized (o1){
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                synchronized (o2){

                }
            }
        }).start();
    }
    public static void s2(){
        new Thread(()->{
            synchronized (o2){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                synchronized (o1){

                }
            }
        }).start();
    }
}
